import React, { Component } from 'react';
import {
	StyleSheet, Text, Animated, View, TouchableOpacity, Image
} from "react-native";
import { GLOBAL } from '../../../config/global';
import { style } from '../../../theme/style';
import Utils from '../../../utils/utils';
import MethodUtil from '../../../utils/MethodUtil';

const scale = GLOBAL.SCALE;


export class ApplyListCard extends Component {
	constructor(props) {
		super(props);
		this.state = {

		}
	}

	render() {
		let { item, winRule, bizModel, salesType, isAll } = this.props;
		return (
			<View style={[styles.offerContent, isAll ? { backgroundColor: '#fff' } : null]}>
				<View style={styles.offerContentItem}>
					<Text style={styles.offerItemTitle}>计划{salesType === 'P' ? '采购' : '销售'}量</Text>
					<Text style={styles.offerItemText}>{item.maxCanSellNum ? item.maxCanSellNum + '吨' : '-'}</Text>
				</View>
				<View style={styles.offerContentItem}>
					<Text style={styles.offerItemTitle}>计划{salesType === 'P' ? '采购' : '销售'}价格</Text>
					<Text style={styles.offerItemText}>{item.price ? item.price + '元/吨' : '-'}</Text>
				</View>
				<View style={styles.offerContentItem}>
					<Text style={styles.offerItemTitle}>升贴水</Text>
					<Text style={styles.offerItemText}>{!Utils.isEmpty(item.udPrice) ? item.udPrice : '-'}</Text>
				</View>
				<View style={styles.offerContentItem}>
					<Text style={styles.offerItemTitle}>成交范围区间</Text>
					<Text style={styles.offerItemText}>{item.minBaseValue && item.maxBaseValue ? item.minBaseValue + '-' + item.maxBaseValue : '-'}</Text>
				</View>
				<View style={styles.offerContentItem}>
					<Text style={styles.offerItemTitle}>参与企业数</Text>
					<Text style={styles.offerItemText}>{item.entQty || '-'}</Text>
				</View>
				<View style={styles.offerContentItem}>
					<Text style={styles.offerItemTitle}>期望{salesType === 'P' ? '采购' : '销售'}总金额</Text>
					<Text style={styles.offerItemText}>{item.purchaseAmt ? item.purchaseAmt : '-'}</Text>
				</View>
				<View style={styles.offerContentItem}>
					<Text style={styles.offerItemTitle}>客户有效提报</Text>
					<Text style={styles.offerItemText}>{item.custPurNum ? item.custPurNum + '吨' : '-'}</Text>
				</View>
				{bizModel === 'Z' ?
					<View style={styles.offerContentItem}>
						<Text style={[styles.offerItemTitle, { color: '#CA0202' }]}>本次申请企业</Text>
						<Text style={[styles.offerItemText, { color: '#CA0202' }]}>{item.sqEntQty || '-'}</Text>
					</View>
					: null
				}
				{winRule === 'ALL' ?
					<View style={styles.offerContentItem}>
						<Text style={[styles.offerItemTitle, { color: '#CA0202' }]}>本次申请总额</Text>
						<Text style={[styles.offerItemText, , { color: '#CA0202' }]}>{item.sqPurchaseAmt ? '¥' + MethodUtil.toThousands(item.sqPurchaseAmt, 2) : '-'}</Text>
					</View>
					: null}
				<View style={styles.offerContentItem}>
					<Text style={[styles.offerItemTitle, { color: '#CA0202' }]}>本次申请总量</Text>
					<Text style={[styles.offerItemText, { color: '#CA0202' }]}>{item.sqPurchaseQty ? item.sqPurchaseQty + '吨' : '-'}</Text>
				</View>
			</View>
		)
	}
}

const styles = StyleSheet.create({
	offerContent: {
		marginTop: 7 * scale,
		backgroundColor: '#F4F7FE',
		borderRadius: 6 * scale,
		paddingVertical: 10 * scale,
		flexDirection: 'row',
		flexWrap: 'wrap'
	},
	offerHorizontal: {
		flexDirection: "row",
		alignItems: 'center',
		marginBottom: 25 * scale
	},
	offerContentItem: {
		width: '33%',
		alignItems: 'center',
		justifyContent: 'center',
		paddingVertical: 10 * scale
	},
	offerItemTitle: {
		// flex: 1,
		fontSize: 11 * scale,
		paddingTop: 5 * scale,
		marginBottom: 5 * scale,
	},
	offerItemText: {
		fontSize: 11 * scale,
	},
})